package com.zelin.page.listener;

import com.zelin.page.service.PageSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.List;

/**
 * ------------------------------
 * 功能：
 * 作者：WF
 * 微信：hbxfwf13590332912
 * 创建时间：2021/8/9-15:02
 * ------------------------------
 */
@Component
public class MyMessageListener {

    @Autowired
    private PageSerivce pageSerivce;

    //1. 根据得到的商品id，生成静态页面
    @JmsListener(destination = "createHtml")
    public void createHtml(String goodsId) throws IOException {
        System.out.println("goodsId = " + goodsId);
        pageSerivce.createHtml(Long.parseLong(goodsId));
    }

    //2. 删除静态页面
    @JmsListener(destination = "deletePage")
    public void deletePage(List<Long> ids){
        pageSerivce.deletePage(ids);
    }
}
